<template>
	<el-container>
		<el-header>
			<div class="left-panel" style="font-size: 18px;">
				系统运行日志
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable ref="table" :data="tableData"  row-key="id" stripe>
				<el-table-column type="selection" width="50"></el-table-column>
				<el-table-column label="日志文件" prop="name" width="300"></el-table-column>
				<el-table-column label="日志大小" prop="progress" width="100">
					<template #default="scope">
						{{(parseFloat(scope.row.fileSize/(1024*1024))).toFixed(2)}}M
					</template>
				</el-table-column>
				<el-table-column label="日志时间" prop="lastModified" width="250"></el-table-column>
				<el-table-column label="操作" fixed="right" align="right" width="120">
					<template #default="scope">
						<el-button-group>
							<el-button text type="primary" size="small" @click="readLog(scope.row, scope.$index)">查看</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
</template>

<script>
import config from "@/config";
export default {
	name: 'tableBase',
	data() {
		return {
			tableData:[],
		}
	},
	mounted() {
		this.getSystemLogList();
	},
	methods: {
		async getSystemLogList()
		{
			var res = await this.$API.system.sysSecurity.getSystemLogList.get();
			if(res.code == 200){
				this.tableData = res.data;
			}else{
				this.$alert(res.message, "提示", {type: 'error'})
			}

		},
		readLog(row,index)
		{
			window.open(config.API_URL+"/get/file/getReadSystemLog?fileName="+row.name+"&ddtab=true","_blank")
		}
	}
}
</script>

<style>
</style>
